package com.kid.keep.controller;


import com.honeybee.cloud.framework.validation.number.Number;
import com.kid.keep.request.AddCheckItemResultRequest;
import com.kid.keep.request.AddChildRequest;
import com.kid.keep.request.CheckItemChildInfoRequest;
import com.kid.keep.request.UpdateChildRequest;
import com.kid.keep.vo.*;
import com.honeybee.cloud.framework.common.response.ResponseEntity;
import com.kid.keep.vo.*;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

/**
 * @Description 爬虫任务
 * @Author DELL
 * @Create 2019-04-29
 * @Since 1.0.0
 */
@RequestMapping("kid-keep")
public interface IChildController {

    /**
     * 保存小孩信息
     *
     * @param addUserRequest
     * @return
     */
    @RequestMapping(name = "保存小孩信息", value = "/v1/children", method = RequestMethod.PUT)
    ResponseEntity<AddChildVO> addChild(@RequestBody @Validated AddChildRequest addUserRequest);

    /**
     * 修改小孩信息
     *
     * @param updateChildRequest
     * @param childId
     * @return
     */
    @RequestMapping(name = "修改小孩信息", value = "/v1/children/{childId}", method = RequestMethod.PUT)
    ResponseEntity<Void> updateChild(@PathVariable("childId") Long childId, @RequestBody @Validated UpdateChildRequest updateChildRequest);

    /**
     * 删除小孩信息
     *
     * @param childId
     * @return
     */
    @RequestMapping(name = "删除小孩信息", value = "/v1/children/{childId}", method = RequestMethod.DELETE)
    ResponseEntity<Void> deleteChild(@PathVariable("childId") Long childId);
    /**
     * 查询小孩详细信息
     *
     * @param childId
     * @return
     */
    @RequestMapping(name = "查询小孩详细信息", value = "/v1/children/{childId}", method = RequestMethod.GET)
    ResponseEntity<ChildVO> getChildDetail(@PathVariable("childId") Long childId);

    /**
     * 查询首页检测小孩详细信息
     * @param request
     * @return
     */
    @RequestMapping(name = "查询首页检测小孩详细信息", value = "/v1/children", method = RequestMethod.POST)
    ResponseEntity<ChildVO> getChildDetail(@RequestBody CheckItemChildInfoRequest request);

    /**
     * 查询用户的小孩详情
     *
     * @param parentId
     * @return
     */
    @RequestMapping(name = "查询用户的所有小孩详情", value = "/v1/{parentId}/children", method = RequestMethod.GET)
    ResponseEntity<List<ChildVO>> getAllChildByParentId(@PathVariable("parentId") Long parentId);


    /**
     * 开启一次测评
     *
     * @param childId
     * @return
     */
    @RequestMapping(name = "开启一次测评", value = "/v1/children/{childId}/reports", method = RequestMethod.PUT)
    ResponseEntity<OpeningCheckItemReportVO> openingCheckItemReport(@PathVariable("childId") Long childId);

    /**
     * 强制开启一次测评
     *
     * @param childId
     * @return
     */
    @RequestMapping(name = "强制开启一次测评", value = "/v1/children/{childId}/reports", method = RequestMethod.POST)
    ResponseEntity<OpeningCheckItemReportVO> forcedOpeningCheckItemReport(@PathVariable("childId") Long childId);
    /**
     * 通过时间类型统计  1 周  2 月  3 年
     *
     * @param type
     * @param childId
     * @return
     */
    @RequestMapping(name = "按时间统计测评报告", value = "/v1/children/{childId}/reports/statistics/{type}", method = RequestMethod.POST)
    ResponseEntity<List<CheckItemReportStatisticsDetailVO>> countCheckReportByDateType(@PathVariable("childId") Long childId,@PathVariable("type") @Validated @Number(enableNull = false, enableValues = {1, 2, 3}, message = "invalid type") Integer type);



}
